<?php	  
class Likes_IndexController extends Zend_Controller_Action
{
	public function init(){
	 $this->_helper->layout()->setLayout('likes_baiviet');
	}
	
	public function indexAction()
	{
	//echo "indexAction";
//	exit;
		$commentid 	=2;
		$likes = new Likes_Model_DbTable_Likes();
      $this->view->likes = $likes->getLikes($commentid );	
		
	}
	
	public function updateAction()
	{
	
		$userid 	=1;
		$commentid = 1;
		$status = 0; // TODO: like or Unlike
		$likes = new Likes_Model_DbTable_Likes();
		$likes->updateStatus($userid, $commentid ,$status);	
	}
	

	
	public function addAction(){
	
	 	$like_user 	=$_GET['like_user'];
		$like_tables=$_GET['like_tables'];
		$like_tables_id = $_GET['like_tables_id'];
				
		$likes = new Likes_Model_DbTable_Likes();
		$this->view->likes = $likes->addlike($like_user, $like_tables ,$like_tables_id);	
		
    }
	public function deleteAction()
	{	
		$commentid 	=$_GET['like_id'];	
		$likes = new Likes_Model_DbTable_Likes();
		$likes->detelelike($commentid);	
	}
	
	public function getuserlikesbypostAction()
	{		
		$idpost =$_GET['post'];
		$table =$_GET['table'];
		
		//TODO: gan user id
		$iduser = 1;
		$likes = new Likes_Model_DbTable_Likes();
	 	$this->view->userlikes  = $likes->getuserlikesbypost($iduser, $idpost, $table);	
		
	}
	
}
?>

